#!/usr/bin/env python
# -*- coding: utf-8 -*-

import unittest

from potherb.key import Key

class   TestClassKey(unittest.TestCase) :

    def test_001(self) :
        row_key = 'row_key_001'
        column_family  = 'test_family'
        column_qualifier = 'test_qualifier'
        flag = 0xFF
        timestamp = 12345678
        key_expect = 'row_key_001 test_family test_qualifier 0xbc614e 0xff'

        key1 = Key(row_key, column_family, column_qualifier, flag, timestamp)
        self.assertEqual(key1.row_key, row_key)
        self.assertEqual(key1.column_family, column_family)
        self.assertEqual(key1.column_qualifier, column_qualifier)
        self.assertEqual(key1.flag, flag)
        self.assertEqual(key1.timestamp, timestamp)
        self.assertEqual(key1.key, key_expect)

        key2 = Key()
        key2.desemble(key_expect)
        self.assertEqual(key2.row_key, row_key)
        self.assertEqual(key2.column_family, column_family)
        self.assertEqual(key2.column_qualifier, column_qualifier)
        self.assertEqual(key2.flag, flag)
        self.assertEqual(key2.timestamp, timestamp)
        self.assertEqual(key2.key, key_expect)

        # test_001

    # class TestClassKey

#######################################################################

if  __name__ == '__main__' :
    unittest.main()
